#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "nvs_flash.h"
#include "led.h"
#include "tftspi.h"

const unsigned char  *point;

/**
 * @brief       程序入口
 * @param       无
 * @retval      无
 */
void app_main(void)
{
	esp_err_t ret;
    point= &picture_tab[0];

    ret = nvs_flash_init(); /* 初始化NVS */

    if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND)
    {
        ESP_ERROR_CHECK(nvs_flash_erase());
        ret = nvs_flash_init();
    }

    led_init();             /* 初始化LED */
	IO_init();              /* 初始化OLED引脚 */
	
	OLED_init();
    OLED_Color_test();
	vTaskDelay(1000);
	OLED_clear();
	
    while(1)
    {
        Picture_display(point);
		vTaskDelay(10000);
        OLED_clear();
		display_char32_32(10,120,RED,china_char[0]);
		display_char32_32(55,120,GREEN,china_char[1]);
		display_char32_32(100,120,BLUE,china_char[2]);
		display_char32_32(145,120,ORANGE,china_char[3]);
		display_char32_32(190,120,PURPLE,china_char[4]);
		vTaskDelay(10000);
		OLED_clear();
        LED(1);
        vTaskDelay(500);   /* 延时500ms */
		LED(0);
        vTaskDelay(500);   /* 延时500ms */
    }
}
